#include "netcli.hpp"
#include <arpa/inet.h>
#include <cstring>
#include <iostream>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>

#define BUFFER_SIZE 1024

int main()
{
    int cnt = 0;
    char buffer[BUFFER_SIZE];

    /* 监听自己的 5000 端口 */
    netcli cli(5000);

    while (cnt < 100) {
        memset(buffer, 0, BUFFER_SIZE);

        /* 从监听的端口上读取数据 */
        cli.recv(buffer, BUFFER_SIZE);

        std::cout << buffer << " : " << cnt << std::endl;
        cnt++;
    }

    return 0;
}
